<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>12_子组件向父组件传值</title>
    <script src="../node_modules/vue/dist/vue.js"></script>
</head>
<body>
    <div id=app> 
        <son @send="handle"></son>
        <br />
        <div>{{content}}</div>
    </div>


    <script>
        const vm = new Vue({
            el:'#app',
            data:{
                content: ''
            },
            methods:{
                handle(m){
                    this.content = m;
                }
            },
            components:{
                son:{
                    template: '<button @click="sendMsg">点我</button>',
                    methods:{
                        sendMsg(){
                            this.$emit('send', '子组件->父组件');
                        }
                    }
                }
            }
        });
    </script>
</body>
</html>